#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 55;
const db eps = 1e-7;

db mat[N][N];
int n;

db delt() {
	db ans = 1;
	rep(i, 1, n - 1) {
		int k = n; rep(j, i, n - 1) if(fabs(mat[j][i]) > eps) { k = j; break; }
		if(k == n) return 0; if(i ^ k) swap(mat[i], mat[k]), ans = -ans;
		rep(j, i + 1, n - 1) {
			db t = mat[j][i] / mat[i][i];
			rep(k, i, n - 1) mat[j][k] -= mat[i][k] * t;
		}
	} rep(i, 1, n - 1) ans *= mat[i][i]; return ans;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in; db ans = 1; rep(i, 1, n) rep(j, 1, n) scanf("%lf", &mat[i][j]), chkmax(mat[i][j], eps), chkmin(mat[i][j], 1 - eps);
	rep(i, 1, n) rep(j, 1, n) (i < j && (ans *= 1 - mat[i][j])), mat[i][j] = mat[i][j] / (1 - mat[i][j]);
	rep(i, 1, n) rep(j, 1, n) if(i ^ j) mat[i][i] += mat[i][j], mat[i][j] = -mat[i][j];
	printf("%.5lf\n", ans * delt());
	return 0;
}
